package com.ttg.model.pojo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ttg.common.constant.UNLExportable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 银行客户信息表
 * @author zhy
 * @date 2024/04/16 14:38
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "tbl_bank_public_primitive_aum")
public class BankPublicPrimitiveAum implements Serializable, UNLExportable {


    private static final long serialVersionUID = -5790136628696702659L;
    /**
     * id
     */
    @TableId(value = "id" , type = IdType.AUTO)
    private Long id;

    /**
     * 数据日期
     */
    @TableField(value = "data_time")
    private String dataTime;


    /**
     * 类型 活期,定期,保险,基金,消费金额,消费笔数,理财
     */
    @TableField(value = "data_type")
    private String dataType;

    /**
     * 核心客户号
     */
    @TableField(value = "core_cust_no")
    private String coreCustNo;
    /**
     * 证件类型
     */
    @TableField(value = "cert_typ")
    private String certTyp;
    /**
     * 证件号码
     */
    @TableField(value = "cert_no")
    private String certNo;
    /**
     * 客户姓名
     */
    @TableField(value = "cust_nm")
    private String certNm;
    /**
     * 客户状态
     */
    @TableField(value = "cust_sts")
    private String custSts;



    /**
     * 时点余额
     */
    @TableField(value = "amount_time")
    private BigDecimal amountTime;


    /**
     * 昨日日均
     */
    @TableField(value = "amount_yesterday_daily_average")
    private BigDecimal amountYesterdayDailyAverage;


    /**
     * 月日均
     */
    @TableField(value = "amount_month_average")
    private BigDecimal amountMonthAverage;


    /**
     * 实际月日均
     */
    @TableField(value = "amount_real_month_average")
    private BigDecimal amountRealMonthAverage;


    /**
     * 上月月日均
     */
    @TableField(value = "amount_last_month_average")
    private BigDecimal amountLastMonthAverage;




    /**
     * 季日均
     */
    @TableField(value = "amount_quarter_average")
    private BigDecimal amountQuarterAverage;


    /**
     * 实际季日均
     */
    @TableField(value = "amount_real_quarter_average")
    private BigDecimal amountRealQuarterAverage;


    /**
     * 上季季日均
     */
    @TableField(value = "amount_last_quarter_average")
    private BigDecimal amountLastQuarterAverage;


    /**
     * 年日均
     */
    @TableField(value = "amount_year_average")
    private BigDecimal amountYearAverage;


    /**
     * 实际年日均
     */
    @TableField(value = "amount_real_year_average")
    private BigDecimal amountRealYearAverage;


    /**
     * 上年年日均
     */
    @TableField(value = "amount_last_year_average")
    private BigDecimal amountLastYearAverage;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;



    @Override
    public String toFieIds(){
        List<String> fieIds = Arrays.asList(
                Objects.isNull(id)?"":id.toString(),
                Objects.isNull(dataTime)?"": dataTime.toString(),
                Objects.isNull(dataType)?"": dataType.toString(),
                Objects.isNull(coreCustNo)?"":coreCustNo.toString(),
                Objects.isNull(certTyp)?"":certTyp.toString(),
                Objects.isNull(certNo)?"":certNo.toString(),
                Objects.isNull(certNm)?"":certNm.toString(),
                Objects.isNull(custSts)?"":custSts.toString(),
                Objects.isNull(amountTime)?"":amountTime.toString(),
                Objects.isNull(amountYesterdayDailyAverage)?"":amountYesterdayDailyAverage.toString(),
                Objects.isNull(amountMonthAverage)?"":amountMonthAverage.toString(),
                Objects.isNull(amountRealMonthAverage)?"":amountRealMonthAverage.toString(),
                Objects.isNull(amountLastMonthAverage)?"":amountLastMonthAverage.toString(),
                Objects.isNull(amountQuarterAverage)?"":amountQuarterAverage.toString(),
                Objects.isNull(amountRealQuarterAverage)?"":amountRealQuarterAverage.toString(),
                Objects.isNull(amountLastQuarterAverage)?"":amountLastQuarterAverage.toString(),
                Objects.isNull(amountYearAverage)?"":amountYearAverage.toString(),
                Objects.isNull(amountRealYearAverage)?"":amountRealYearAverage.toString(),
                Objects.isNull(amountLastYearAverage)?"":amountLastYearAverage.toString(),
                Objects.isNull(updateTime)?"":updateTime.toString()
        );
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < fieIds.size(); i++) {
            String fieId = fieIds.get(i);
            if (fieId.contains("|")||fieId.contains("\"")){
                fieId="\""+fieId.replace("\"","\"\"")+"\"";
            }
            sb.append(fieId);
            if (i<fieIds.size()-1){
                sb.append("|");
            }
        }
        return sb.toString();
    }
}
/*

 */